//输入
//"(abcd)"
//
//输出
//dcba  // 括号中内容要反转
const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let initStr;
rl.on("line", (line)=>{
    if(initStr === undefined) {
        initStr = line.trim()
        console.log(getResult(initStr))

        // clear
        initStr = undefined
    }

})


function getResult(initStr) {
    initStr = initStr.replaceAll('"', "")
    if(initStr.indexOf("(") === -1) {
        return initStr
    } else {
        let stack = []
        for (const char of initStr) {
            if(char === ")") {
                let str = ""
                while(stack.length) {
                    if(stack.at(-1) !== "(") {
                    str  = stack.pop() + str
                    } else {
                        stack.pop()
                        break
                    }
                }
                stack.push(str.split("").reverse().join(""))
            } else {
                stack.push(char)
            }
        }

        return stack.join("")



    }

}



